package com.guigui.gulimall.ware.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.guigui.common.to.OrderTo;
import com.guigui.common.to.StockLockedTo;
import com.guigui.common.to.ware.WareStockVo;
import com.guigui.common.utils.PageUtils;
import com.guigui.gulimall.ware.dto.OrderLockDto;
import com.guigui.gulimall.ware.entity.PurchaseDetailEntity;
import com.guigui.gulimall.ware.entity.WareSkuEntity;

import java.util.List;
import java.util.Map;

/**
 * 商品库存
 *
 * @author xin
 * @email 806748502@qq.com
 * @date 2021-07-23 16:07:56
 */
public interface WareSkuService extends IService<WareSkuEntity> {

    PageUtils queryPage(Map<String, Object> params);

    /**
     * 添加入库
     */
    void addWare(List<PurchaseDetailEntity> detailIds);

    /**
     * 是否有库存
     */
    List<WareStockVo> getStock(List<Long> skuId);

    /**
     * 锁定库存
     */
    List<WareStockVo> lockProduct(OrderLockDto orderLockDto);

    /**
     * 解锁库存
     * @param stockLockedTo 订单任务详情id
     */
    void unLockStock(StockLockedTo stockLockedTo);

    /**
     * 通过订单解锁库存
     * @param order 订单
     */
    void unLockStock(OrderTo order);
}

